import practice._112_PathSum;
import practice.tree.binary.BinaryTreeTraversaller;
import struct.BinaryTree;

/**
 * 测试用类
 */
public class Main {
    public static void main(String[] args) {


    }

    /**
     * 二叉树遍历测试
     */
    private static void binaryTreeTravel(){
        BinaryTree root = new BinaryTree(0);
        BinaryTree binaryTree1 = new BinaryTree(1, 2, 3);
        BinaryTree binaryTree2 = new BinaryTree(4, 5, 6);
        binaryTree1.getLeftNode().setRightNode(new BinaryTree(5));
        binaryTree1.getRightNode().setLeftNode(new BinaryTree(6)).setRightNode(new BinaryTree(3));
        binaryTree2.getLeftNode().setRightNode(new BinaryTree(9));
        binaryTree2.getRightNode().setRightNode(new BinaryTree(12));
        root.setLeftNode(binaryTree1).setRightNode(binaryTree2);
        /**
         *
         *               0
         *         1            4
         *     2       3     5     6
         *      5    6   3     9     12
         */
        System.out.println("-----先序遍历-----");
        System.out.print("递归：");
        BinaryTreeTraversaller.preOrderRecursion(root);
        System.out.println();
        System.out.print("非递归:");
        BinaryTreeTraversaller.preOrderUnRecursion(root);
        System.out.println("\n--------------");
        System.out.println("-----中序遍历-----");
        System.out.print("递归：");
        BinaryTreeTraversaller.inOrderRecursion(root);
        System.out.println();
        System.out.print("非递归：");
        BinaryTreeTraversaller.inOrderUnRecursion(root);
        System.out.println("\n--------------");
        System.out.println("-----后序遍历-----");
        System.out.print("递归：");
        BinaryTreeTraversaller.postOrderRecursion(root);
        System.out.println();
        System.out.print("非递归：");
        BinaryTreeTraversaller.postOrderUnRecursion(root);
        System.out.println("\n--------------");
        System.out.println("-----层序遍历-----");
        System.out.println("层数：" + BinaryTreeTraversaller.getLevel(root));
        System.out.print("递归：");
        BinaryTreeTraversaller.levelOrderRecursion(root, true);
        System.out.println();
        System.out.print("非递归：");
        BinaryTreeTraversaller.levelOrderUnRecursion(root, true);

    }


}
